uniform float shiftX;
uniform float shiftY;
uniform sampler2D texture;

void main()
{
//  vec4 c = texture2D( texture, gl_TexCoord[0].st );
  vec4 color;
  color.rgb = gl_Color.rgb * gl_Color.a;
  color.a = gl_Color.a;
 
  vec2 planeCoords = vec2(gl_TexCoord[0].st);
  float newX = planeCoords.x - shiftX;
  float newY = planeCoords.y - shiftY;  
  if(newX < 0.0) 
      newX = 0.0;
  else if(newX > 1.0)
      newX = 1.0;
  if(newY < 0.0) 
      newY = 0.0;
  else if(newY > 1.0)
      newY = 1.0;

  vec2 shiftedPlaneCoords = vec2(newX, newY);
  vec4 shiftedTexel = texture2D(texture, shiftedPlaneCoords);

  //gl_FragColor = c * color;
  gl_FragColor = shiftedTexel * color;
}
